package com.example.devicemanage.service.impl;

import com.example.devicemanage.dao.ApplyMapper;
import com.example.devicemanage.entity.Apply;
import com.example.devicemanage.service.inter.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApplyServiceimp implements ApplyService {
    @Autowired
    ApplyMapper applyMapper;

    @Override
    public List<Apply> queryAllApply() {

        return applyMapper.queryAllApply();
    }

    @Override
    public int passApply(int aid) {

        return applyMapper.passApply(aid);
    }

    @Override
    public Boolean deleteApply(int aid) {
        if (applyMapper.deleteApply(aid) == 0) return false;
        else return true;
    }

    @Override
    public int saveApply(Apply apply) {
        return applyMapper.saveApply(apply);
    }

    @Override
    public int updateApply(Apply apply) {
        applyMapper.deleteApply(apply.getAid());
        return applyMapper.updateApply(apply);
    }
}
